﻿Imports Negocio
Imports Servicios
Imports Excepciones

Public Class frmUsuarioCambioPass

    Private _usuario As New Usuario()

    Protected Overrides Sub PreLoad()
        Me.Icon = Icon.FromHandle(Global.SIPRO.My.Resources.Resources.key.GetHicon())
    End Sub

    Sub New()
        InitializeComponent()
    End Sub

    Sub New(usuario As Usuario)
        Me.New()
        _usuario = usuario
    End Sub

    Private Sub btnGuardar_Click(sender As System.Object, e As System.EventArgs) Handles btnGuardar.Click
        If MyBase.ValidateForm() Then
            Try
                _usuario.Clave = txtClave.Text
                GesUsuarios.Guardar(_usuario)
                Me.Close()
                Me.DialogResult = Windows.Forms.DialogResult.OK
            Catch ex As Exception
                My.Application.HandlerException(New UsuarioSaveException())
            End Try
        End If
    End Sub

    Private Sub btnCancelar_Click(sender As System.Object, e As System.EventArgs) Handles btnCancelar.Click
        Me.Close()
    End Sub

#Region "Validaciones"
    Private Sub txtClave_Validating(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles txtClave.ValidatingAfter
        Utilidades.Validations.ValueEquals(txtClave.Text, txtClaveRep.Text)
    End Sub
#End Region

End Class